﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using MyFloridaHouse.libSTO;
using MyFloridaHouse.DataAccess;

namespace MyFloridaHouse.libServiceBusinessRules
{
	/// <summary>
	/// Region Data methods
	/// </summary>
    public static class RegionData
    {
		/// <summary>
		/// Gets the region data list.
		/// </summary>
		/// <param name="iLayerID">The ilayerID.</param>
		/// <param name="iRegionID">The iregionID.</param>
		/// <returns>Object: <see cref="RegionDataListSTO"/></returns>
        public static RegionDataListSTO GetRegionDataList(int iLayerID, int iRegionID)
        {
            RegionDataListSTO results = new RegionDataListSTO();
            results.layerID = iLayerID;
            try
            {
                DAL_CensusData dal = new DAL_CensusData();
                var queryResults = dal.GetRegionData(iLayerID, iRegionID);
				results.regionDataList = (from q in queryResults select q).ToList();
            }
            catch (Exception ex)
            {
                results.errorMessage = ex.Message;
                return results;
            }
            return results;
        }
    }
}
